package com.by.controller;

import com.by.bean.Full;
import com.by.bean.query.FullQuery;
import com.by.common.core.bean.PageBean;
import com.by.common.core.bean.ResultBean;
import com.by.common.core.controller.BaseController;
import com.by.service.FullService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 满额活动控制层
 */
@RestController
@RequestMapping("/sl")
@Api(tags = "营销管理")
@Slf4j
public class FullController extends BaseController{

    @Autowired
    FullService fullService;

    @ApiOperation("查询满额活动列表")
    @PostMapping("/fullQuery")
    public ResultBean<PageBean> FullQuery(@RequestBody FullQuery query){
        PageBean bean=fullService.search(query);
        log.info("查询结果:" + bean);
        return success("查询成功",bean);
    }

    /**
     * 保存满额活动
     * @param full
     * @return
     */
    @PostMapping("/save")
    @ApiOperation("保存满额活动")
    public ResultBean save(@RequestBody Full full){
        int rs=fullService.saveEntity(full);
        log.info("保存结果:" + rs);
        return saveResult(rs);
    }

    /**
     * 查看满额详情
     * @param id
     * @return
     */
    @GetMapping("/getFull")
    @ApiOperation("查看满额详情")
    public ResultBean getFull(Integer id){
        Full full=fullService.getEntity(id);
        log.info("查询结果:" + full);
        return success("查询成功",full);
    }



}
